package com.zhiyou100.api.collections_demo;

import java.util.Arrays;
import java.util.List;
import java.util.function.Consumer;

public class Lambda_demo {

    public static void main(String[] args) {




    }


    public static void test(){
        List<Integer> list = Arrays.asList(12,45,78,98,65,21,32);
        //展开写
        list.forEach(new Consumer<Integer>() {
            @Override
            public void accept(Integer integer) {
                System.out.println(integer);
            }
        });

        //使用lambda表达式简写
        list.forEach(integer -> System.out.println(integer));


    }


}
